---
description: Use Postgres indexes with Hasura
keywords:
  - hasura
  - docs
  - postgres
  - indexes
sidebar_position: 6
sidebar_label: Indexes
---

# Postgres Indexes

## Introduction

[Postgres indexes](https://www.postgresql.org/docs/current/sql-createindex.html) are a way of increasing query
performance based on columns that are queried frequently. The concept is similar to the one of an index in a book. It
helps accessing the data you're looking for more quickly by maintaining additional metadata.

:::info Note

Learn more about indexes in the [Postgres documentation](https://www.postgresql.org/docs/current/sql-createindex.html).

:::

## Example

**Create an index on the column name in the table authors:**

Let's say the database receives a large number of requests of authors being queried by their name, for example:

```sql
SELECT * FROM authors WHERE name = 'J.K. Rowling';
```

We can now create an index on the `name` column of the `authors` table:

```sql
CREATE INDEX author_name_index ON authors (name);
```

Since the database is now able to look up the result of these queries more quickly, the performance of these queries
will increase significantly.

## Postgres indexes & Hasura

Indexes can be used to optimize query performance in Hasura.
[Refer to this page](/queries/postgres/performance.mdx#pg-data-validation-pg-indexes) for information about query
performance and how to add Postgres indexes to Hasura.
